****Replication File for "Left-Right Social Identity and the Polarization of Political Tolerance" by Mark Peffley, Omer Yair, and Marc Hutchison, published in Political Research Quarterly, 2024, 77(1), 30-44. 

*SET THE CLEAR MESH VARSION OF GRSTYLE
grstyle init
grstyle set plain, nogrid noextend

*use "Peffley et al 2024 PRQ replication data.dta"

**TABLE 1, FIGURE 1
*Model 1 - LLG Demon/Speak
reg llg_demsp08rr_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 llg_thrt_demoid_01_w1 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store llg6
	margins, at(polid_01r=(0 1) polsoc4_all01_01=(0(.2)1))
*Figure 1 - Panel 1
	marginsplot, xdimension(polsoc4_all01_01)  ytitle("Political Tolerance (0-1)", size(small)) xtitle(Left-Right Social Identity) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(llg2, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
	
*Model 2 - ACI Demon/Speech
reg ac_demsp2r_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab6
	margins, at(polid_01r=(0 1) polsoc4_all01_01=(0(.2)1))
*Figure 2 - Panel 2
	marginsplot, xdimension(polsoc4_all01_01) ytitle("Political Tolerance (0-1)", size(small)) xtitle(Left-Right Social Identity) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(aci2, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
	
*Model 3 - ACI Civil Liberties 
reg ac_intol3_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab7
	margins, at(polid_01r=(0 1) polsoc4_all01_01=(0(.2)1)) 
*Figure 2 - Panel 3
	marginsplot, xdimension(polsoc4_all01_01) ytitle("Political Tolerance (0-1)", size(small)) xtitle(Left-Right Social Identity) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(aci3, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))

*Generating Table 1
esttab llg6 arab6 arab7, b(%6.2f) p(%6.2f) ar2(%4.2f) wide nodepvars compress label
esttab llg6 arab6 arab7, b(%6.2f) se(%6.2f) ar2(%4.2f) wide nodepvars compress label

*Generating Figure 1
graph combine llg2 aci2 aci3, l1(Political Tolerance (0-1)) b1(Left-Right Social Identity) ycommon xcommon cols(3) 

******************************************************************************************

**TABLE 2, FIGURE 2
*Model 4 - Baseline Condition
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==0, b
	estimates store control
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
*Figure 2 - Panel 1
	marginsplot, xdimension(polsoc4_all01_01) title("Baseline (No Attacks)", size(large)) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(cond0, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))

*Model 5 - Suspected Palestinian Attackers
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==1 & ftex_guess_group_noterrid==3, b
	estimates store suspal
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
*Figure 2 - Panel 2
	marginsplot, xdimension(polsoc4_all01_01) title("Suspected Palestinian Attackers", size(large)) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(cond1pal, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
		
*Model 6 - Arab Citizen Attackers 
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==3, b
	estimates store aci
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
*Figure 2 - Panel 3
	marginsplot, xdimension(polsoc4_all01_01) title("Arab Citizen Attackers", size(large)) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(cond3, replace)  
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))

*Generating Table 2	
esttab control suspal aci, b(%6.2f) p(%6.2f) ar2(%4.2f) wide nodepvars compress label
esttab control suspal aci, b(%6.2f) se(%6.2f) ar2(%4.2f) wide nodepvars compress label

*Generating Figure 2	
graph combine cond0 cond1pal cond3, l1(Oppose Ban-Detain ACI (0-1)) b1(Left-Right Social Identity) ycommon xcommon cols(3) 

******************************************************************************************

**TABLE 3
*Model 7 - Baseline Condition
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01 i.polid_01r##c.engage4b_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==0, b
	estimates store control_eng
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
	margins, at (polid_01r=(0 1) engage4b_01=(0(.1)1))
	margins, dydx(engage4b_01) at (polid_01r=(0 1))
	
*Model 8 - Suspected Palestinian Attackers
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01 ac_thrt2_08_01 i.polid_01r##c.engage4b_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==1 & ftex_guess_group_noterrid==3, b
	estimates store suspal_eng
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
	margins, at (polid_01r=(0 1) engage4b_01=(0(.1)1))
	margins, dydx(engage4b_01) at (polid_01r=(0 1))

*Model 9 - Arab Citizen Attackers 
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01 ac_thrt2_08_01 i.polid_01r##c.engage4b_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==3, b
	estimates store aci_eng
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
	margins, at (polid_01r=(0 1) engage4b_01=(0(.1)1))
	margins, dydx(engage4b_01) at (polid_01r=(0 1))

*Generating Table 3
esttab control suspal aci control_eng suspal_eng aci_eng, b(%6.2f) se(%6.2f) ar2(%4.2f) wide nodepvars compress label

**********************************************************************************************************************
**********************************************************************************************************************
**********************************************************************************************************************
**********************************************************************************************************************


**************************MODELS AND FIGURES FOR ONLINE APPENDIX**************************

**SECTION A.
**Note Table A1 was calculated based on the original sample before bad respondents were dropped for failing attention screens

**Generating Variable Means and SD for Table A2 
sum llg_demsp08rr_01 ac_demsp2r_01 ac_intol3_01 polid_01r polsoc4_extrnopra_01 freespch3r_01_w1 llg_thrt_demoidr2_01 ac_thrt2_08_01 rank_jewish0_israeli1 authororig4_0_1 religid01 engage4b_01 educ04_01 inc_nomiss_01 age_01 female ftex_supp_ac2_01 

**Generating Table A3. Least-Liked Group Selection
tab llg_selectr_taba1
proportion llg_selectr_taba1, percent 
proportion llg_selectr_taba1 if polid_01r==0, percent 
proportion llg_selectr_taba1 if polid_01r==1, percent

**Generating Table A4. Correlations
corr polid_01r polsoc4_all01_01 authororig4_0_1 freespch3r_01_w1 llg_thrt_demoid_01_w1 ac_thrt2_08_01
pwcorr polid_01r polsoc4_all01_01 authororig4_0_1 freespch3r_01_w1 llg_thrt_demoid_01_w1 ac_thrt2_08_01, sig

**Generating Table A5. Variable Means, W1 & W2
*wave 1
sum polid_01r polsoc4_extrnopra_01 authororig4_0_1 freespch3r_01_w1 llg_thrt_demoid_01_w1 ac_thrt2_08_01 age_01 female religid01 

*wave 2
sum polid_01r polsoc4_extrnopra_01 authororig4_0_1 freespch3r_01_w1 llg_thrt_demoid_01_w1 ac_thrt2_08_01 age_01 female religid01 if	ftex_supp_ac2_01~=.	& ftexp_rand_ct_gpal_aci_012~=. & polsoc4_extrnopra_01~=.

******************************************************************************************
******************************************************************************************

***SECTION B.
**Model to generate Figure A1
reg polsoc4_all01_01 c.freespch3r_01_w1##i.polid_01r rank_jewish0_israeli1##polid_01r c.authororig4_0_1##polid_01r c.age_01 c.female c.religid01 c.educ04_01 c.inc_nomiss_01, b
	estimates store coef_socID
	esttab  coef_socID, b(%6.2f) se(%6.2f) ar2(%4.2f) wide label

*Generating Figure A1	
coefplot (coef_socID, label(R-L Social ID)), drop(_cons age_01 female religid01 educ04_01 inc_nomiss_01 polid_01r) xline(0) msymbol(d) mlabel format(%9.2g) mlabposition(12)mlabgap(*2) ciopts(lwidth(*2)) label levels(90 95) legend(region(lstyle(none))) title(R-L Social ID) xlabel(-.6(.2).6) ysize(4) xsize(6)

*Generating Figure A2. Histogram
 twoway (histogram polsoc4_all01_01 if polid_01r==0, bin(10) fraction fcolor(blue%60)  ) ///
	(histogram polsoc4_all01_01 if polid_01r==1, bin(10) fraction fcolor(maroon%60) xtitle(Left-Right Social Identity)) 

******************************************************************************************
******************************************************************************************
	
****SECTION C.
**LLG W/ARABS
reg llg_demsp08rr_01 c.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 llg_thrt_demoidr2_01  age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store llg1	
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))

**LLG W/OUT ARABS
reg llg_demsp08rr_01 c.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 llg_thrt_demoidr2_01 age_01 female religid01 educ04_01 inc_nomiss_01 if arab_llgr==0, b
	estimates store llg2	
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))

*Generating table
esttab llg1 llg2, b(%6.2f) p(%6.2f) ar2(%4.2f) wide nodepvars compress label
esttab llg1 llg2, b(%6.2f) se(%6.2f) ar2(%4.2f) wide nodepvars compress label

*Generating Figure A3 
coefplot (llg1, label(LLG-Incl Arab Grps)) (llg2, label(LLG-Excl Arab Grps)) , drop(_cons age_01 female religid01 educ04_01 inc_nomiss_01 ) xline(0) msymbol(d) mfcolor(white) ciopts(lwidth(*2))  levels(90 95) legend(region(lstyle(none))) title(Least-Liked Group (LLG) Political Tolerance) xlabel(-.6(.2).6) ysize(4) xsize(6)

******************************************************************************************
******************************************************************************************

***SECTION D.
*Models and individual plots
reg llg_demsp08rr_01 c.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 llg_thrt_demoidr2_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store llg1
	margins, at(polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(LLG1, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
	
reg llg_demsp08rr_01 c.polid_01r##(c.polsoc4_all01_01 c.freespch3r_01_w1 c.authororig4_0_1 c.llg_thrt_demoidr2_01) age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store llg2
	margins, at(polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(LLG2, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
	
reg ac_demsp2r_01 c.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab1
	margins, at(polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(ACI1, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
			
reg ac_demsp2r_01 c.polid_01r##(c.polsoc4_all01_01 c.freespch3r_01_w1 c.authororig4_0_1 c.ac_thrt2_08_01) age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab2
	margins, at(polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(ACI2, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
	
reg ac_intol3_01 c.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store ACI31
	margins, at(polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(ACI31, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
			
reg ac_intol3_01 c.polid_01r##(c.polsoc4_all01_01 c.freespch3r_01_w1 c.authororig4_0_1 c.ac_thrt2_08_01) age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store ACI32
	margins, at(polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(ACI32, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))

*Generating Table A6
esttab  llg1 llg2 arab1 arab2 ACI31 ACI32, b(%6.2f) se(%6.2f) ar2(%4.2f) wide label
*Note that only coefficients for the Right and Left are used in Table A6
		
*Generating coefplots for Figure A4
coefplot (llg1, label(LLG(Dem/Spk)-Model 1)) (llg2, label(LLG(Dem/Spk)-Model 2)), drop(_cons age_01 female religid01 educ04_01 inc_nomiss_01 ) xline(0) msymbol(d)  ciopts(lwidth(*2))  levels(90 95) legend(region(lstyle(none))) title(Political Tolerance) xlabel(-.6(.2).6) ysize(4) xsize(6) 

coefplot (arab1, label(ACI(Dem/Spk)-Model 1)) (arab2, label(ACI(Dem/Spk)-Model 2)), drop(_cons age_01 female religid01 educ04_01 inc_nomiss_01 ) xline(0) msymbol(d)  ciopts(lwidth(*2))  levels(90 95) legend(region(lstyle(none))) title(Political Tolerance) xlabel(-.6(.2).6) ysize(4) xsize(6) 

coefplot (ACI31, label(ACI(CivLib)-Model 1)) (ACI32, label(ACI(CivLib)-Model 2)), drop(_cons age_01 female religid01 educ04_01 inc_nomiss_01 ) xline(0) msymbol(d)  ciopts(lwidth(*2))  levels(90 95) legend(region(lstyle(none))) title(Political Tolerance) xlabel(-.6(.2).6) ysize(4) xsize(6) 

******************************************************************************************
******************************************************************************************

***SECTION E.

***NOTE:  The Table A7 in the original online appendix was incorrect as it presented coefficients for 4-item models but beta coefficients for 3-item models.  We have subsequently updated the table in a revised online appendix included in this replication data.

*Table A7 in original online appendix
*4-item Index
*LLG Demon/Speak
reg llg_demsp08rr_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 llg_thrt_demoid_01_w1 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store llg6
*ACI Demon/Speech
reg ac_demsp2r_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab6
*ACI Civil Liberties 
reg ac_intol3_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab7

*3-item Index
*LLG Demon/Speak
reg llg_demsp08rr_01 i.polid_01r##c.polsoc3_all01_01 freespch3r_01_w1 authororig4_0_1 llg_thrt_demoid_01_w1 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store llg6_3i	
*ACI Demon/Speech
reg ac_demsp2r_01 i.polid_01r##c.polsoc3_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab6_3i
*ACI Civil Liberties 
reg ac_intol3_01 i.polid_01r##c.polsoc3_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab7_3i

*Generating Table A7
esttab llg6 arab6 arab7, b(%6.2f) se(%6.2f) ar2(%4.2f) wide nodepvars compress label
esttab llg6_3i arab6_3i arab7_3i, beta(%6.2f) se(%6.2f) ar2(%4.2f) wide nodepvars compress label
esttab llg6 arab6 arab7, b(%6.2f) p(%6.2f) ar2(%4.2f) wide nodepvars compress label
esttab llg6_3i arab6_3i arab7_3i, beta(%6.2f) p(%6.2f) ar2(%4.2f) wide nodepvars compress label

******************************************************************************************

*Corrected Table A7 presenting coefficients for 4-item and 3-item models (shown in the revised appendix included in this replication folder)
*4-item Index
*LLG Demon/Speak
reg llg_demsp08rr_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 llg_thrt_demoid_01_w1 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store llg6
*ACI Demon/Speech
reg ac_demsp2r_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab6
*ACI Civil Liberties 
reg ac_intol3_01 i.polid_01r##c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab7

*3-item Index
*LLG Demon/Speak
reg llg_demsp08rr_01 i.polid_01r##c.polsoc3_all01_01 freespch3r_01_w1 authororig4_0_1 llg_thrt_demoid_01_w1 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store llg6_3i	
*ACI Demon/Speech
reg ac_demsp2r_01 i.polid_01r##c.polsoc3_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab6_3i
*ACI Civil Liberties 
reg ac_intol3_01 i.polid_01r##c.polsoc3_all01_01 freespch3r_01_w1 authororig4_0_1 ac_thrt2_08_01 age_01 female religid01 educ04_01 inc_nomiss_01, b
	estimates store arab7_3i

*Generating Table A7
esttab llg6 arab6 arab7 llg6_3i arab6_3i arab7_3i, b(%6.2f) p(%6.2f) ar2(%4.2f) wide nodepvars compress label
esttab llg6 arab6 arab7 llg6_3i arab6_3i arab7_3i, b(%6.2f) se(%6.2f) ar2(%4.2f) wide nodepvars compress label

******************************************************************************************
******************************************************************************************

***SECTION F.
**Generating panels for Figure A5 
*Figure A5, Panel 1	   
interflex ftex_supp_ac2_01 polid_01r polsoc4_extrnopra_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==1 & ftex_guess_group_noterrid==3, vce(r)
	graph save interbin_12, replace 

*Figure A5, Panel 2
interflex ftex_supp_ac2_01 polid_01r polsoc4_extrnopra_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==1 & ftex_guess_group_noterrid==3, type(kernel) 
	graph save interkernel_12, replace 
	   
*Figure A5, Panel 3
interflex ftex_supp_ac2_01 polid_01r polsoc4_extrnopra_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==3, vce(r)
	graph save interbin_3, replace 

*Figure A5, Panel 4
interflex ftex_supp_ac2_01 polid_01r polsoc4_extrnopra_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==3, type(kernel)  
	graph save interkernel_3, replace 

******************************************************************************************
******************************************************************************************
	
***SECTION G.
**Generating Table A9. Most Respondents Guess the Attackers were Palestinians from the Occupied Territories (Changes include dropping Other(Missing) from calculation of percentage of "Palestinians from the Occupied Territories"
tab ftex_guess_group_noterrid if ftex_guess_group_noterrid!=6

**Models to generate Table A10 and Figure A6
*Model - 'Suspected Palestinians Attacked Only'
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==1 & ftex_guess_group_noterrid==3, b
	estimates store suspal
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) title("Suspected Palestinian Attackers", size(large)) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(suspal, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
		
*Model - 'All Groups Guessed'
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==1 & ftex_guess_group_noterrid~=6, b
	estimates store allbutmiss
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) title("Guess Attackers", size(medium)) ytitle("Oppose Ban-Detain ACI (0-1)", size(small))  ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(allbutmiss, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
		
*Generating Table A10			
esttab suspal allbutmiss, b(%6.2f) se(%6.2f) ar2(%4.2f) wide nodepvars compress label
			
*Generating Figure A6
graph combine suspal allbutmiss, l1(Oppose Ban-Detain ACI (0-1)) b1(Left-Right Social Identity)

*********************************************	

**Models to generate Table A11
*Model - Baseline With Controls
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==0, b
	estimates store control
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) title("Baseline (No Attacks)", size(large)) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(cond0, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
		
*Model - Suspected Palestinian Attack With Controls
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==1 & ftex_guess_group_noterrid==3, b
	estimates store suspal
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) title("Suspected Palestinian Attackers", size(large)) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(cond1pal, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
		
*Model - Arab Citizen Attack With Controls
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand==3, b
	estimates store aci
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) title("Arab Citizen Attackers", size(large)) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(cond3, replace)  
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))

*Model - Baseline Without Most Controls
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01  if ftexp_rand==0, b
	estimates store control_nocont
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) title("Baseline (No Attacks)", size(large)) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(cond0, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
		
*Model - Suspected Palestinian Attack Without Most Controls
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01  if ftexp_rand==1 & ftex_guess_group_noterrid==3, b
	estimates store suspal_nocont
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) title("Suspected Palestinian Attackers", size(medium)) ytitle("Oppose Ban-Detain ACI (0-1)", size(small)) ylabel(0(.2)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(cond1pal, replace)
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1))
		
*Model - Arab Citizen Attack Without Most Controls
reg ftex_supp_ac2_01 i.polid_01r##c.polsoc4_all01_01  if ftexp_rand==3, b
	estimates store aci_nocont
	margins, at (polid_01r=(0 1) polsoc4_all01_01=(0(.1)1))
	marginsplot, xdimension(polsoc4_all01_01) title("Arab Citizen Attackers", size(large))   ylabel(0(.2)1)   recast(line) recastci(rarea) ciopts(color(*.4%50)) name(cond3, replace)  
	margins, dydx(polsoc4_all01_01) at (polid_01r=(0 1) )

*Generating Table A11	
esttab  control suspal aci control_nocont suspal_nocont aci_nocont, b(%6.2f) p(%6.2f) ar2(%4.2f) wide nodepvars compress label
esttab  control suspal aci control_nocont suspal_nocont aci_nocont, b(%6.2f) se(%6.2f) ar2(%4.2f) wide nodepvars compress label

******************************************************************************************
******************************************************************************************

***SECTION H.
*Models to generate panel graphs for Figure A7a
*Panel A
reg ftex_supp_ac2_01 i.ftexp_rand_ct_gpal_aci_012##i.polid_01r##c.polsoc4_all01_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand_ct_gpal_aci_012<2, b
	margins r.ftexp_rand_ct_gpal_aci_012, at(polid_01r=(0 1) polsoc4_all01_01=(0(.2)1))
	marginsplot, xdimension(polsoc4_all01_01) bydimension(polid_01r) ytitle("Contrast (Baseline v Susp Pal Attackers)",  size(small)) xtitle(Right-Left Social Identity) ylabel(-1(.2)1) yline(0) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(diff95_01, replace)

*Panel B
reg ftex_supp_ac2_01 i.ftexp_rand_ct_gpal_aci_012##i.polid_01r##c.polsoc4_all01_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if ftexp_rand_ct_gpal_aci_012==0 | ftexp_rand_ct_gpal_aci_012==2, b
	margins r.ftexp_rand_ct_gpal_aci_012, at(polid_01r=(0 1) polsoc4_all01_01=(0(.2)1))
	marginsplot, xdimension(polsoc4_all01_01) bydimension(polid_01r) ytitle("Contrast (Baseline v Arab Citizen Attackers)",  size(small)) xtitle(Right-Left Social Identity) ylabel(-1(.2)1) yline(0) recast(line) recastci(rarea) ciopts(color(*.4%50))  name(diff95_02, replace)

*Generating Figure A7a
graph combine diff95_01 diff95_02 

*************************************************************

*Model for Figure A7b
reg ftex_supp_ac2_01 i.ftexp_rand01##i.polid_01r##c.polsoc4_all01_01 ac_thrt2_08_01 freespch3r_01_w1 authororig4_0_1 age_01 female religid01 educ04_01 inc_nomiss_01 if  ftex_guess_group_noterrid~=6, b
	margins r.ftexp_rand01, at(polid_01r=(0 1) polsoc4_all01_01=(0(.2)1))

*Generating Figure A7b
marginsplot, xdimension(polsoc4_all01_01) bydimension(polid_01r) ytitle("Contrast (Baseline v Guess All Attackers)",  size(small)) xtitle(Right-Left Social Identity) ylabel(-1(.2)1) yline(0) recast(line) recastci(rarea) ciopts(color(*.4%50))  name(diff95_01, replace)

******************************************************************************************
******************************************************************************************

***SECTION I.
**Models to generate Figure A8 and Table A12
*Leftists
reg rt_demspk2r_w3_01 c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 rt_thrtdemoid2_w3_01 age_01 female religid educ04_01 inc_nomiss_01 if polid_01r==1, b
	estimates store lft_tol
	margins, at(polsoc4_all01_01=(0(.1)1))
	*Panel A for Figure A8
	marginsplot, xdimension(polsoc4_all01_01) ytitle("Leftists' Tolerance of Rightists (0-1)", size(small)) xtitle(Social Identity) ylabel(0(.1)1) recast(line) recastci(rarea) ciopts(color(maroon*.4%50)lcolor(black%0)) plotopts(lcolor(maroon)) name(rht_tol, replace)
	margins, dydx(polsoc4_all01_01) 
	
*Rightists
reg lt_demspk2r_w3_01 c.polsoc4_all01_01 freespch3r_01_w1 authororig4_0_1 lt_thrtdemoid2_w3_01 age_01 female religid educ04_01 inc_nomiss_01 if polid_01r==0, b
	estimates store rht_tol
	margins, at(polsoc4_all01_01=(0(.1)1))
	*Panel B for Figure A8
	marginsplot, xdimension(polsoc4_all01_01) ytitle("Rightists' Tolerance of Leftists (0-1)", size(small)) xtitle(Social Identity) ylabel(0(.1)1) recast(line) recastci(rarea) ciopts(color(*.4%50)) name(lft_tol, replace)
	margins, dydx(polsoc4_all01_01) 

*Generating Figure A8
graph combine rht_tol lft_tol, l1(Political Tolerance (0-1)) b1(Left-Right Social Identity)

*Generating Table A12			
esttab  lft_tol rht_tol, b(%6.2f) se(%6.2f) ar2(%4.2f) wide nodepvars compress label










